<template>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="处置部门">
      <SelectGroup v-model="form.handleDept" :api="`tenantTree`" @change="onChangeGroup"></SelectGroup>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
export default {
  data() {
    return {
      form: {},
    };
  },
  methods: {
    onSubmit() {
      this.$refs["form"].validate(async (valid) => {
        if (valid) {
          this.$emit("submit", this.form);
        }
      });
    },
    onChangeGroup(data) {
      this.$set(this.form, "handlerDeptName", data.name);
      console.log(this.form);
    },
  },
};
</script>